package com.controller;

import com.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class HelloController {

    @Autowired
    private Student student;

    @RequestMapping("/index/{id}")
    public String sayHello(@PathVariable("id") Integer id){
        System.out.println("测试----------》》》"+id);
        System.out.println(student);
        return "index.html";
    }

    @RequestMapping("/index")
    public String getList(){
        List<Student> studentList = new ArrayList<>();
        Student s1 = new Student();
        s1.setSname("王恩泽");
        studentList.add(s1);
        studentList.add(s1);
        studentList.add(s1);
        return "student.html";
    }

}
